#!/usr/bin/pythonBasics
# -*- coding: utf-8 -*-
# @Time : 2021/4/11 13:23
# @Author : super
# @File : demo01
# @Project : pythonFile

'''查询在SC表存在成绩的学生信息'''

import mysql.connector.pooling #数据库连接池
import time
from datetime import *

#输入config链接信息
config = {
	'host' : '180.76.240.206',
	'port' : 3306,
	'user' : 'sql180_76_240_2',
	'password' : '123456',
	'database' : 'sql180_76_240_2'
}
#开启数据库连接池
try:
	pool = mysql.connector.pooling.MySQLConnectionPool(
		**config,
		pool_size = 10
	)
	con = pool.get_connection()
	con.start_transaction()
	cursor = con.cursor()
	cursor.execute('SELECT * FROM sxo_user')
	for item in cursor:
		print(item)
	con.commit()

except Exception as e:
	if 'con' in dir():
		con.rollback()
	print(e)
